bunyan = require('bunyan')

config = require './config'

exports.debug = true # TODO 远程开关

system = bunyan.createLogger({name: "system", level: "trace"})
pay = bunyan.createLogger({name: "pay", level: "trace"})
tppCallback = bunyan.createLogger({name: "tppCallback", level: "trace"})

exports.system = system
exports.pay = pay
exports.tppCallback = tppCallback

exports.debug = ->
    if exports.debug
        system.debug.apply system, arguments

logs = {}
exports.logs = logs

if config.logs
    for name, logConfig of config.logs
        logs[name] = bunyan.createLogger logConfig


